package com.malty.apimanage.controller;

import com.malty.apimanage.domain.dto.user.api.UserApiStatistic;
import com.malty.apimanage.service.UserApiInfoService;
import com.malty.common.domain.Result;
import com.malty.common.util.ResultUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author malty
 */
@Api(tags = "API统计分析")
@RestController
@RequestMapping("/admin/api/statistic")
public class ApiStatisticController {
    @Resource
    private UserApiInfoService userApiInfoService;

    @ApiOperation("接口调用统计")
    @GetMapping("/invoke")
    public Result<List<UserApiStatistic>> apiStatistics() {
        List<UserApiStatistic> apiStatistics = userApiInfoService.getApiStatistics();
        return ResultUtils.success(apiStatistics);
    }
}
